<?php session_start();
include "../conexao.php";

if (!isset($_SESSION["txt_login"]) and !isset($_SESSION["txt_senha"]))
{ print "<script type = 'text/javascript'> location.href = 'login.php'</script>"; exit();}

$id       = $_GET["id"];
$acao     = $_GET["acao"];
$aprovar  = $_GET["aprovar"];

if($acao=="Excluir"){

   $sql = "delete from comentario_noticias where id_comentario='$id'";
   mysql_query($sql);
   
 
echo "<script type \"text/JavaScript\">
				alert(\"Comentario excluido com sucesso.\");
			</script>"; 
			print "<script type = 'text/javascript'> location.href = 'principal.php?link=27'</script>";
}

if($acao=="Excluiraprovadas"){

   $sql = "delete from comentario_editorial where id_comentario='$id'";
   mysql_query($sql);
   
 
echo "<script type \"text/JavaScript\">
				alert(\"Mensagem excluida com sucesso.\");
			</script>"; 
			print "<script type = 'text/javascript'> location.href = 'mensagens_aprovadas_editorial.php'</script>";
}




if($aprovar=="sim"){

   mysql_query("UPDATE comentario_noticias SET aprovado = 'S' WHERE id_comentario = '$id'");
   
echo "<script type \"text/JavaScript\">
				alert(\"Comentario aprovado.\");
			</script>"; 
			print "<script type = 'text/javascript'> location.href = 'principal.php?link=27'</script>";
}

?>